//
// Created by qsy on 2023/8/29.
//
#include "USR-K2.h"
#include "stdio.h"
#include "NodeSystemInfo.h"

void usr_init(void)
{

    //重启设备
    printf("AT+Z\n");
    HAL_Delay(300);

    //进入AT指令模式
    printf("+++");
    HAL_Delay(300);

    //确认指令
    printf("a");
    HAL_Delay(300);


    //---AT指令操作部分---

    //读取eeprom内的系统参数,存入到NodeSysInfo结构体中
    NodeInfo_Read_fromEEPROM();

    //设置网络协议参数格式AT+SOCK=TCPC,192.168.0.100,8080
    printf("AT+SOCK=TCPC,%d.%d.%d.%d,%d\n",NodeSysInfo.IP_addr[0],NodeSysInfo.IP_addr[1],
           NodeSysInfo.IP_addr[2],NodeSysInfo.IP_addr[3],NodeSysInfo.portNumber);
    HAL_Delay(300);

    //------------------

    //重启设备
    printf("AT+Z\n");
    HAL_Delay(300);
}